package anatex.service;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import javax.validation.constraints.Min;

@RooJavaBean
@RooToString
@RooEntity
public class Settings {
	
    private Boolean keaServiceEnabled;

    @Min(1L)
    private Integer keaTimeInterval;
    
    private Boolean translationServiceEnabled;
    
    @Min(1L)
    private Integer translationTimeInterval;
    
    public static Settings getDefaultConfig(){
    	Settings def = new Settings();
    	def.keaServiceEnabled = true;
    	def.keaTimeInterval = 20;
    	def.translationServiceEnabled = true;
    	def.translationTimeInterval = 120;
    	return def;
    };
    
    public static Settings getConfig(){
    	Settings config;
    	try{
    		config = Settings.findSettingsEntries(0,1).get(0);
    	}catch(Exception ex){
    		config = getDefaultConfig();
    	}
    	return config;
    }
    
    
    
}




